import java.util.Scanner;

public class demo2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n=scanner.nextInt();
        String s = Integer.toBinaryString(n);
        int max=0;
        for(int i=0;i<s.length();i++) {
            int count=0;
            while(s.charAt(i)=='1') {
                count++;
                i++;
            }
            max=max>count?max:count;
        }
        System.out.println(max);
    }
}
